package com.foreknow.demo5;

public class Ex {
    public static void me(int[] array) {
        //int[] array = {1, 2, 2, 3, 4, 4, 5};

        for (int i = 0; i < array.length; i++) {
            for (int j = i + 1; j < array.length; j++) {
                if (array[i] == array[j]) {
                    array[j] = 0;
                }
            }
        }

        // 输出结果数组
        System.out.println("去重后的数组：");
        for (int value : array) {
            System.out.print(value + " ");
        }
    }
    public static void main(String[] args) {
        int[] array = {1, 2, 2, 3, 4, 4, 5};
        Ex.me(array);

    }
}
